<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="jakarta.tags.core" %>

<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>医疗预约系统 - 管理员登录</title>
  <style>
    * {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
      font-family: 'Microsoft YaHei', sans-serif;
    }

    body {
      background-color: #f5f5f5;
      display: flex;
      justify-content: center;
      align-items: center;
      height: 100vh;
    }

    .login-container {
      background-color: white;
      padding: 30px;
      border-radius: 8px;
      box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
      width: 100%;
      max-width: 400px;
    }

    h2 {
      text-align: center;
      margin-bottom: 20px;
      color: #333;
    }

    .form-group {
      margin-bottom: 20px;
    }

    .form-group label {
      display: block;
      margin-bottom: 8px;
      font-weight: bold;
      color: #555;
    }

    .form-group input[type="text"],
    .form-group input[type="password"],
    .form-group select {
      width: 100%;
      padding: 10px;
      border: 1px solid #ddd;
      border-radius: 4px;
      font-size: 16px;
    }

    input[type="text"]:focus,
    input[type="password"]:focus {
      border-color: #4a90e2;
      outline: none;
    }

    button {
      width: 100%;
      padding: 12px;
      background-color: #4a90e2;
      color: white;
      border: none;
      border-radius: 4px;
      font-size: 16px;
      cursor: pointer;
      transition: background-color 0.3s;
    }

    button:hover {
      background-color: #357abD;
    }

    .error-message {
      color: #e74c3c;
      font-size: 14px;
      margin-top: 5px;
      display: none;
    }
  </style>
</head>
<body>
<div class="login-container">
  <h2>医疗预约系统登录</h2>
  <form id="loginForm" method="post" action="adminLogin">
    <div class="form-group">
      <label for="username">用户名</label>
      <input type="text" id="username" name="userName" required>
      <div class="error-message" id="usernameError"></div>
    </div>

    <div class="form-group">
      <label for="password">密码</label>
      <input type="password" id="password" name="userPassword" required>
      <div class="error-message" id="passwordError"></div>
    </div>
    <div class="form-group">
      <label for="userType">请选择身份</label>
      <select id="userType" name="userType" required>
        <option value="">请选择身份</option>
        <option value="1">病人</option>
        <option value="3">管理员</option>
      </select>
    </div>

    <button type="submit">登录</button>
  </form>
  
  <div style="text-align: center; margin-top: 20px;">
    <p>病人用户请<a href="<%=request.getContextPath()%>/auth/register" style="color: #4a90e2; text-decoration: none;">注册账号</a></p>
  </div>
  <c:if test="${param.flag eq '-1'}">
    <div style="color: red;font-size: 20px" >用户名或密码错误</div>
  </c:if>
</div>

</body>
</html>
